#include <iostream>
#include<ctime>
#define N 10

using namespace std;

double ave(double *a,int n)
{
    double avg=0.0,*p=a;
    int i;
    for(i=1;i<n;i++,p++) avg=avg+*p;

        return n<=0?0:avg/n;
}

int main( )
{
    double a[N];
    int i;

    srand((unsigned int)time(0));

    for(i=0;i<N;i++)
    {
        a[i]=rand()%100;
    }

    cout<<"average="<<ave(a,N)<<endl;
   
    cin>>i;
    return 0;
}
